/*
 * 浮点类型转换器
 */
package com.slipper.common.excel.parse.support;

import org.apache.poi.ss.usermodel.Cell;

import com.slipper.common.excel.ExcelColumn;

public class DoubleParse extends CellParse {

    @Override
    public Object parse(Cell cell, ExcelColumn column) throws Exception {
        String value = super.parserCellValue(cell, column);
        if (value != null && column.length() != 0 && value.length() > column.length()) {
            throw new Exception("数字的最大长度应小于等于：" + column.length() + "！");
        }
        try {
            assert value != null;
            return Double.parseDouble(value);
        } catch (Exception e) {
            throw new Exception("数字格式错误！");
        }
    }
}
